package com.example.activity.service;

import com.example.activity.dao.AppFormDao;
import com.example.activity.pojo.ApplForm;
import lombok.extern.slf4j.Slf4j;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.bpmn.model.FlowNode;
import org.activiti.bpmn.model.SequenceFlow;
import org.activiti.editor.language.json.converter.util.CollectionUtils;
import org.activiti.engine.*;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.task.TaskQuery;
import org.activiti.image.ProcessDiagramGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;

import java.io.InputStream;
import java.util.*;

/**
 * @author Create by Ron
 * @date 2020/5/13 17:08
 */
@Slf4j
@Service
public class UserTaskService {


    @Autowired
    /**
     * 执行管理、包括启动、推进、删除流程实例等操作
     * */
    private RuntimeService runtimeService;
    @Autowired
    /**
     * 任务管理
     * */
    private TaskService taskService;

    /**
     * 表单相关服务
     */
    @Autowired
    private AppFormDao appFormDao;




    public List<Task> getTask(Integer loginId) {

        if (loginId == 3) {
            List<Task> zg = taskService.createTaskQuery().taskName("主管").list();

            return zg;
        } else if (loginId == 2) {
            List<Task> zj = taskService.createTaskQuery().taskName("总监").list();
            return zj;
        } else if (loginId == 4) {
            List<Task> yh = taskService.createTaskQuery().taskName("用户填写").list();
            return yh;
        } else if (loginId == 5) {
            List<Task> yh = taskService.createTaskQuery().taskName("人事").list();
            return yh;
        }
        return null;
    }



}
